#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
//int main()
//{
//	int weight, hight;
//	double a = 0.0;
//	while (scanf("%d %d", &weight, &hight) != EOF)
//	{
//		a = hight / 100.0;
//		if (weight / (a * a) < 18.5)
//			printf("Underweight\n");
//		else if (weight / (a * a) >= 18.5 && weight / (a * a) <= 23.9)
//			printf("Normal\n");
//		else if (weight / (a * a) >= 23.9 && weight / (a * a) <= 27.9)
//			printf("Overweight\n");
//		else
//			printf("Obese\n");
//	}
//	return 0;
//}
//int main()
//{
//	printf("Happy New Year*2019*");
//	return 0;
//}
//int main()
//{
//	printf("I will learn C++ well!");
//	return 0;
//}
int main()
{
	int a, b, c, d,e;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	e = (a + b - c) * d;
	printf("%d\n", e);
	return 0;
}


